package org.zfes.snowier.cloud.zbss.cms.router.service.column;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.column.model.CmsColumnUserDefineAttr;
import org.zfes.snowier.cloud.zbss.cms.column.service.ICmsColumnUserDefineAttrService;
@Controller("org.zfes.snowier.cloud.zbss.cms.column.router.service.CmsColumnUserDefineAttrController")   
@RequestMapping("/cms/service/column/cmsColumnUserDefineAttr")
public class CmsColumnUserDefineAttrController extends BaseController {

	
	@Autowired
	private ICmsColumnUserDefineAttrService cmsColumnUserDefineAttrService;
	
	@RequiresPermissions(value="cmsColumnUserDefineAttr:loadCmsColumnUserDefineAttrDataSet",desc="栏目用户自定义属性列表")
    @RequestMapping(value="/loadCmsColumnUserDefineAttrDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsColumnUserDefineAttrDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsColumnUserDefineAttrService.loadCmsColumnUserDefineAttrDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsColumnUserDefineAttr:createCmsColumnUserDefineAttr",desc="栏目用户自定义属性添加")
    @RequestMapping(value="/createCmsColumnUserDefineAttr", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsColumnUserDefineAttr(CmsColumnUserDefineAttr cmsColumnUserDefineAttr){
		cmsColumnUserDefineAttrService.createCmsColumnUserDefineAttr(cmsColumnUserDefineAttr);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsColumnUserDefineAttr:loadCmsColumnUserDefineAttr",desc="栏目用户自定义属性加载")
    @RequestMapping(value="/loadCmsColumnUserDefineAttr", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsColumnUserDefineAttr(Long id){
		Optional<CmsColumnUserDefineAttr> ops = cmsColumnUserDefineAttrService.loadCmsColumnUserDefineAttrById(id);
		return ajaxQuery("cmsColumnUserDefineAttr",ops);
    }
	
	@RequiresPermissions(value="cmsColumnUserDefineAttr:updateCmsColumnUserDefineAttr",desc="栏目用户自定义属性更新")
    @RequestMapping(value="/updateCmsColumnUserDefineAttr", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsColumnUserDefineAttr(CmsColumnUserDefineAttr cmsColumnUserDefineAttr){
		cmsColumnUserDefineAttrService.updateCmsColumnUserDefineAttr(cmsColumnUserDefineAttr);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsColumnUserDefineAttr:deletCmsColumnUserDefineAttr",desc="栏目用户自定义属性删除")
    @RequestMapping(value="/deleteCmsColumnUserDefineAttr", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsColumnUserDefineAttr(Long id){
		cmsColumnUserDefineAttrService.deleteCmsColumnUserDefineAttr(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}